package com.itheima.service.impl;

import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 查询所有用户
     * @return
     */
    @Override
    public List<User> getAllUsers() {
        List<User> userList = userMapper.findAllUsers();
        return userList;
    }

    /**
     * 根据id查询用户信息及其订单
     * @param id
     * @return
     */
    @Override
    public User getUserById(Integer id) {
        User user = userMapper.findUserById(id);
        return user;
    }
}
